<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增APP轮播图')"/>
                                                                                                                            <th:block th:include="include :: bootstrap-fileinput-css"/>
                                                                            </head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-carousel-add">
                                                                                                                                                    <div class="form-group">
                            <label class="col-sm-3 control-label">图片名字
                                ：</label>
                            <div class="col-sm-8">
                                <input name="name" class="form-control" type="text">
                            </div>
                        </div>
                                                                                                                                                                        <div class="form-group">
                            <label class="col-sm-3 control-label">状态
                                ：</label>
                            <div class="col-sm-8">
                                <div class="radio-box" th:each="dict : ${@dict.getType('app_enable_status')}">
                                    <input type="radio" th:id="${'status_' + dict.dictCode}" name="status"
                                           th:value="${dict.dictValue}"
                                           th:checked="${dict.default}">
                                    <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                                </div>
                            </div>
                        </div>
                                                                                                                                                                        <div class="form-group">
                            <label class="col-sm-3 control-label">图片的URL
                                ：</label>
                            <div class="col-sm-8">
                                <input type="hidden" name="url">
                                <div class="file-loading">
                                    <!--<input class="form-control file-upload" id="url" name="file" type="file">-->
                                    <input class="file" type="file" multiple data-min-file-count="1" data-theme="fas">
                                </div>
                            </div>
                        </div>
                                                                                        </form>
</div>
<th:block th:include="include :: footer"/>
                                                                                                                        <th:block th:include="include :: bootstrap-fileinput-js"/>
                                                                            <script th:inline="javascript">
    var prefix = ctx + "system/carousel"
            $("#form-carousel-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-carousel-add').serialize());
        }
    }
                                                                                                                                                                                            
            $(".file-upload").fileinput({
                uploadUrl: ctx + 'common/upload',
                maxFileCount: 1,
                autoReplace: true
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
                                                                                                                                            </script>
</body>
</html>